package ru.integrationmessagers.vk.model.response.self;

import lombok.Builder;
import lombok.Data;
import ru.integrationmessagers.vk.model.dto.self.AbstractDto;

import java.util.List;

@Data
@Builder
public class Response<DTO extends AbstractDto> {

    private Integer count;
    private List<DTO> items;

    public static <D extends AbstractDto> Response<D> from(List<D> dtoList) {
        return Response.<D>builder()
                .items(dtoList)
                .count(dtoList.size())
                .build();
    }
}
